/*
JuffEd - A simple text editor
Copyright 2007 Murzin Mikhail

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License 
version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#ifndef _TEXT_DOC_WIDGET_H_
#define _TEXT_DOC_WIDGET_H_

class Document;
class LineNumWidget;
class QTextDocument;
class Core_Text_Edit;

#include <QtGui/QWidget>

class TextDocWidget : public QWidget {
Q_OBJECT
public:
	TextDocWidget(Document*, QWidget*);

	void cut();
	void copy();
	void paste();

	void find(const QString&, bool, bool);
	void gotoLine(int);

	void setDocument(QTextDocument* doc);
	void applySettings();
	Document* document() { return doc_; }
	void getCursorPos(int&, int&);

signals:
	void cursorPositionChanged();

protected slots:
	void updateLayout();
	void scrolled(int);

protected:
	virtual void resizeEvent(QResizeEvent*);

private:
	Core_Text_Edit* edit_;
	LineNumWidget* lineNumWidget_;
	Document* doc_;
};

#endif
